package jianzhiOffer;
//剑指 Offer 57. 和为s的两个数字
public class Num57_twoSum {
    public int[] twoSum(int[] nums, int target) {
        int left = 0 ;
        int right = nums.length-1;
        while (left<right){
            if (nums[left] + nums[right] < target){
                left++;
            }else if (nums[left] + nums[right] >target){
                right--;
            }else {
                return new int [] {nums[left],nums[right]};
            }

        }
        return new int[0];

    }

}
